<template>
  <div class="login_container">
    <div class="login_wrapper">
      <div class="login_wrapper_container">
        <div class="login_title">登录账号</div>
        <div class="login_message">虾米 - 严选商城欢迎您</div>
        <!-- 两个输入框 -->
        <div class="">
          <van-form @submit="onSubmit">
            <van-field
              class="van_username"
              v-model="username"
              name="pattern"
              placeholder="手机号码"
              :rules="[{ required: true, message: '请填写正确的手机号码',pattern:/^1[3456789]\d{9}$/ }]"
            />
            <van-field
              class="van_username"
              v-model="password"
              type="password"
              name="pattern"
              placeholder="密码"
              :rules="[{ required: true, message: '请填写正确的密码' ,pattern:/^(?=.*[a-zA-Z])(?=.*[0-9])[A-Za-z0-9]{8,18}$/ }]"
            />
            <div class="login_button_container">
              <van-button round block type="info" 
              class="login_button"
              native-type="submit">登录</van-button>
            </div>
          </van-form>
        </div>
        <!-- 功能操作 -->
        <div class="forget_password">
            <span>忘记密码</span>
        </div>
        <div class="register_container">
            <span @click="toRegister()">还没有注册？ 立即注册</span>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
      password: "",
    //   pattern:/^1[3456789]\d{9}$/
    };
  },
  methods: {
    onSubmit(values) {
      console.log("submit", values);
    },
    toRegister(){
        console.log(123123)
        this.$router.push('/register')
    }
  }
};
</script>

<style scoped>
.login_container {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: flex-start;
}
.login_wrapper {
  width: 90%;
  height: 11rem;
  border: 0.05rem solid #f5f5f5;
  border-radius: 0.1rem;
  margin-top: 5%;
  display: inline-flex;
  justify-content: center;
  align-items: flex-start;
}
.login_wrapper_container {
  width: 80%;
  margin-top: 5%;
}
.login_title {
  width: 100%;
  height: 1.5rem;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 0.5rem;
}
.login_message {
  width: 100%;
  height: 0.8rem;
  color: gray;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 0.3rem;
}
.van_username {
    background-color: #F5F5F5;
    border-radius: 0.1rem;
    margin-top: 0.4rem;
    color: #757575;
}
.login_button_container {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
.login_button {
    margin-top: 0.5rem;
    width: 4rem;
    border-radius: 0.2rem;
    height: 1rem;
    background: linear-gradient(135deg, #e570e7 0%, #79f1fc 100%);
    border: 0px;
    font-size: 0.3rem;
    font-weight: 700;
}
.forget_password span {
    width: 100%;
    margin-top: 0.5rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 0.18;
    color: gray;
}
.register_container span {
    width: 100%;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #549FF9;
    font-size: 0.3rem;
}
</style>